package com.cxs.observer.spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author: cxs
 */
@Component
public class WeatherSpring {

    @Autowired
    private List<ObServerSpring> obServerSprings;

    // 温度
    private Double temp;

    public Double getTemp() {
        return temp;
    }

    public void setTemp(Double temp) {
        this.temp = temp;
        notifyOb();
    }

    public void notifyOb() {
        for (ObServerSpring obServerSpring : obServerSprings) {
            obServerSpring.doUpdate();
        }
    }

}
